<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport"
	content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta name="misapplication-tap-highlight" content="no" />
<meta name="HandheldFriendly" content="true" />
<meta name="MobileOptimized" content="320" />
<title>请假审批单</title>
<link
	href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
	rel="stylesheet">
<script
	src="http://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js">
	<script type="text/javascript" src="js/update.js">
</script>
<script type="text/javascript" charset="utf-8">
	//获取所有的请假信息
	$.ajax({
		type:"get",
		url:"/askleave/listcheck",
		success:function(data){
			for(var i=0;i<data.length;i++){
				var temp = '<li id="plus/accelerometer.html"><span class="item">请假类型:'+data[i].qingJiaTypeName+'<div class="chs" style="float: right; margin-right: 15px;">请假人员:'+data[i].personName+' </div></span></li>';
				$("#plist").append(temp);
			}
			
		}
		
	})

	//取消浏览器的所有事件，使得active的样式在手机上正常生效
	document.addEventListener('touchstart', function() {
		return false;
	}, true);
	// 禁止选择
	document.oncontextmenu = function() {
		return false;
	};

	// H5 plus事件处理
	var as = 'pop-in';// 默认窗口动画
	function plusReady() {
		// 隐藏滚动条
		plus.webview.currentWebview().setStyle({
			scrollIndicator : 'none'
		});
		// Android处理返回键
		plus.key.addEventListener('backbutton', function() {
			('iOS' == plus.os.name) ? plus.nativeUI.confirm('确认退出？',
					function(e) {
						if (e.index > 0) {
							plus.runtime.quit();
						}
					}, 'HelloH5', [ '取消', '确定' ])
					: (confirm('确认退出？') && plus.runtime.quit());
		}, false);
		compatibleAdjust();
	}
	if (window.plus) {
		plusReady();
	} else {
		document.addEventListener('plusready', plusReady, false);
	}
	// DOMContentLoaded事件处理
	var _domReady = false;
	document.addEventListener('DOMContentLoaded', function() {
		_domReady = true;
		compatibleAdjust();
	}, false);
	// 兼容性样式调整
	var _adjust = false;
	function compatibleAdjust() {
		if (_adjust || !window.plus || !_domReady) {
			return;
		}
		_adjust = true;
		// iOS平台特效
		if ('iOS' == plus.os.name) {
			document.getElementById('content').className = 'scontent'; // 使用div的滚动条
			if (navigator.userAgent.indexOf('StreamApp') >= 0) { // 在流应用模式下显示返回按钮
				document.getElementById('back').style.visibility = 'visible';
			}
		}
		// 预创建二级窗口
		//	preateWebviews();
		// 关闭启动界面
		plus.navigator.setStatusBarBackground('#D74B28');
		setTimeout(function() {
			plus.navigator.closeSplashscreen();
		}, 200);
	}
	// 处理点击事件
	var _openw = null;
	/**
	 * 点击打开新窗口
	 * @param {Object} id	加载的页面地址，也用作窗口标识
	 * @param {Object} a	页面动画内心，默认使用全局as设置的值
	 * @param {Object} s	是否不显示窗口
	 */
	function clicked(id, a, s) {
		if (_openw) {
			return;
		}
		a || (a = as);
		_openw = preate[id];
		if (_openw) {
			_openw.showdedrue;
			_openw.show(a, null, function() {
				_openw = null;//避免快速点击打开多个页面
			});
		} else {
			//		var wa=plus.nativeUI.showWaiting();
			//		_openw=plus.webview.create(id,id,{scrollIndicator:'none',scalable:false,popGesture:'hide'},{preate:true});//复用二级页面
			_openw = plus.webview.create(id, id, {
				scrollIndicator : 'none',
				scalable : false,
				popGesture : 'close'
			});
			preate[id] = _openw;
			_openw.addEventListener('loaded', function() {//叶面加载完成后才显示
				//		setTimeout(function(){//延后显示可避免低端机上动画时白屏
				//			wa.close();
				_openw.showded = true;
				s || _openw.show(a, null, function() {
					_openw = null;//避免快速点击打开多个页面
				});
				s && (_openw = null);//避免s模式下变量无法重置
				//		},10);
			}, false);
			_openw.addEventListener('hide', function() {
				_openw && (_openw.showded = true);
				_openw = null;
			}, false);
			_openw.addEventListener('close', function() {//页面关闭后可再次打开
				_openw = null;
				preate[id] && (preate[id] = null);//兼容窗口的关闭
			}, false);
		}
	}
	// 预创建二级页面
	var preate = {};
	function preateWebviews() {
		preateWebivew('plus/webview.html');
		var plist = document.getElementById('plist').children;
		// 由于启动是预创建过多Webview窗口会消耗较长的时间，所以这里限制仅创建5个
		for (var i = 0; i < plist.length && i < 2; i++) {
			var id = plist[i].id;
			id && (id.length > 0) && preateWebivew(id);
		}
	}
	function preateWebivew(id) {
		if (!preate[id]) {
			var w = plus.webview.create(id, id, {
				scrollIndicator : 'none',
				scalable : false,
				popGesture : 'hide'
			}, {
				preate : true
			});
			preate[id] = w;
			w.addEventListener('close', function() {//页面关闭后可再次打开
				_openw = null;
				preate[id] && (preate[id] = null);//兼容窗口的关闭
			}, false);
		}
	}
	// 清除预创建页面(仅)
	function preateClear() {
		for ( var p in preate) {
			var w = preate[p];
			if (w && w.showded && !w.isVisible()) {
				w.close();
				preate[p] = null;
			}
		}
	}
</script>
<link rel="stylesheet" href="css/common.css" type="text/css"
	charset="utf-8" />
<style type="text/css">
li {
	padding: 0.8em;
	border-bottom: 1px solid #eaeaea;
}

li:active {
	background: #f4f4f4;
}

.iabout {
	background: no-repeat center center
		url();
	background-size: 50px 44px;
}

.item {
	display: block;
	background: no-repeat right center
		url();
	background-size: 12px 22px;
	-ms-touch-action: auto;
}

.chs {
	font-size: 0.8em;
	color: #838383;
}
</style>
</head>
<body onselectstart="return false;">
	<header id="header">
	<div id="back" style="visibility: hidden" class="nvbt iback"
		onclick="plus.runtime.quit()"></div>
	<div class="nvbt iabout"
		onclick="clicked('about.html','zoom-fade-out',true)"></div>
	</header>
	<script type="text/javascript">
	</script>
	<div id="content" class="content">
		<ul id="plist"
			style="list-style: none; margin: 0; padding: 0; text-align: left;">
			
		</ul>
	</div>
</body>
<script type="text/javascript" src="js/immersed.js"></script>
<script type="text/javascript" src="js/shortcut.js"></script>
<script type="text/javascript">
	function startTime() {
		$("#beginTime").click();
	}

	function commit() {

		var reg = /^\d+(\.\d+)?$/;
		if (!reg.test($("#days").val())) {
			alert("天数格式输入不正确！");
			return false;
		}
		var formData = new FormData();
		var uploadFile = $('#file').get(0).files[0];
		formData.append("file", uploadFile || 0);
		formData.append("id", 0);
		formData.append("startTime", $("#startTime").val());
		formData.append("endTime", $("#endTime").val());
		formData.append("remark", $("#remark").val());
		formData.append("days", $("#days").val());
		formData.append("picture", $("#picture").val());
		formData.append("qingJiaTypeId", $('#qingJiaTypeId option:selected')
				.attr('value'));
		formData.append("personId", $("#userid").val());
		$.ajax({
			url : '../phone/weixinAdd',
			type : 'POST',
			dataType : "json",
			data : formData,
			async : false,
			cache : false,
			contentType : false, //不设置内容类型  
			processData : false, //不处理数据  
			success : function(data) {
				if (data.status == 200) {
					alert(data.message);
				} else {
					alert(data.message);
				}
			}
		});
	}
</script>

</html>